
package ?й?????????;
import java.util.Scanner;

public class ZhaoXu45 {
	public static void main(String[] args) {
		
		int ymima=123321,xmima,i=1,j=1,c=0,qk,gn,ck,zz; //???????????????????????????????????i?????ж???????
		String kh;
		float zh=1000; //?????????????????????????
		Scanner sr=new Scanner(System.in);  //sr?????????
		System.out.println("?й????????л????");
		while(i<=3)
			{
			System.out.println("??????????");
		    xmima=sr.nextInt();
		if(xmima!=ymima)
			System.out.println("????????????????");
		if(xmima==ymima)
		{
		
			while(j<=10) {
			System.out.println("????????ù???");
			System.out.println("1               ???");	
			System.out.println("2               ???");
			System.out.println("3               ???");
			System.out.println("4               ???");
			System.out.println("5               ???");
			System.out.println("6        ??????");
			gn=sr.nextInt();
		     if(gn==1) {
		    	 System.out.println("???????????"+zh);
		    	 
		       gn=sr.nextInt();
		         if(gn==6)
		        
		        	 continue;  
		   // for(m=1;m<=999999999;m++ )
		    	//	;
		    	 //_getch();
		     }
		    if(gn==2)
		    {
		    	
		    	System.out.println("???????????");
		    	qk=sr.nextInt();
		    	while(c<5) {
		    	if(qk>zh||qk<100||qk%100!=0)
		    		{System.out.println("??????????涨????????????????????????");
		    		qk=sr.nextInt();
		    		//if(qk>zh||qk<100||qk%100!=0)
		    		break;
		    		}
		    	//??????????β?????????????
					 {
		    		 zh=zh-qk;
					 System.out.println("??????????");
					 System.out.println("????????????"+zh);
					 System.out.println("??????6???????????");	 
					 }
					 	{
		    	gn=sr.nextInt();
		   	 System.out.println("??????6???????????");	 
		         if(gn==6)
		        	 continue;
					 	}
		    	}
		    }  
		    if(gn==3) 
		    {
		    	System.out.println("?????????100????????????"); 
		    	ck=sr.nextInt();
		    	while(c<5) {
			    	if(ck>zh||ck<100||ck%100!=0)
			    		{System.out.println("??????????涨????????????????????????");
			    		ck=sr.nextInt();
			    		//if(qk>zh||qk<100||qk%100!=0)
			    		break;
			    		}
			    	//??????????β?????????????
		    	{
		    	zh=zh+ck;
		    	System.out.println("?????????"+zh); 
		    	}
		    	{
			    	gn=sr.nextInt();
			   	 System.out.println("??????6???????????");	 
			         if(gn==6)
			        	 continue;
						 	}
		    }	    
		 if(gn==4) 
		 {
			 System.out.println("??????????????");
			 kh=sr.next();
			 if(kh.length()!=12)
					System.out.print("??????????????????????\n");
			 else{
			 System.out.println("???????????");
			 zz=sr.nextInt();
			 
			 if(zz>zh) 
				 System.out.println("????????????????????");
			 else
					 zh=zh-zz;
			 System.out.println("?????????"+zh); 
			 	{
			 		 System.out.println("??????6???????????");	 
			 		gn=sr.nextInt();
			 		if(gn==6)
			 		continue;
			 	}
		    
		 }
		 
		 if(gn==5)
		 {
			 System.exit(0);
		 }
		 
		
		i++;
		if(i>3&&xmima!=ymima)
		{
			System.out.println("????????????????????????????");
			break;
			
		}												//???????????????????????????? 	 
	    }
	}
}
		}
		}
	}
}
	